﻿using System;
using System.Net;
using System.Windows.Forms;

namespace NTime
{
    public partial class NtimeMainForm : Form
    {
        public NtimeMainForm()
        {
            InitializeComponent();           
        }

        private NetTime nt = new NetTime();

        private void btnFresh_Click(object sender, EventArgs e)
        {
            if (UpdateTime.SetDate(nt.getDT()))
                MessageBox.Show("同步成功");
            else
                MessageBox.Show("同步失败");
            label2.Text = DateTime.Now.ToString();
        }

        private void NtimeMainForm_Load(object sender, EventArgs e)
        {
            timer1.Start();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            label2.Text = DateTime.Now.ToString();
            label4.Text = nt.getDT().ToString();
        }
    }
}